package com.awphone.data;

import com.awphone.data.constant.EObjectType;
import com.awphone.data.constant.StateConst;

import javax.persistence.*;

/**
 * @author a_polyakov
 * Date: 03.03.13
 * Time: 22:35
 * Штат
 */
@Entity
@Table(schema = StateConst.SCHEMA_NAME, name = StateConst.TABLE_NAME)
public class State extends AbstractObject {
    /**
     * Страна
     */
    private Country country;
    /**
     * Наименование
     */
    private String name;
    /**
     * Часовой пояс
     */
    private Integer timeZone;

    {
        setObjectType(EObjectType.STATE);
    }

    public State() {
    }

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = StateConst.S_COUNTRY, nullable = false, updatable = false)
    public Country getCountry() {
        return country;
    }

    public void setCountry(Country country) {
        this.country = country;
    }

    @Column(name = StateConst.S_NAME, nullable = false)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = StateConst.S_TIME_ZONE)
    public Integer getTimeZone() {
        return timeZone;
    }

    public void setTimeZone(Integer timeZone) {
        this.timeZone = timeZone;
    }
}
